from fastapi import FastAPI
from service.FileConversion import to_docx, to_html
import uvicorn
from pydantic import BaseModel

app = FastAPI()


class FileData(BaseModel):
    file_path: str


@app.get("/")
async def root():
    return {"message": "Hello World test 成功 eruwertioois"}


@app.get("/hello/{name}")
async def say_hello(name: str):
    return {"message": f"Hello {name}"}


@app.post("/convert/toDocx")
async def convert_docx(file_path: FileData):
    return to_docx(file_path)


@app.post("/convert/toHtm")
async def convert_htm(file_path: FileData):
    return to_html(file_path)


# if __name__ == '__main__':
#     uvicorn.run(app='main:app', host="192.168.91.129", port=8000, reload=True)
